@include("layout.header")
<body>
<div id="content" class="content">
    <form id="mainForm" class="main-form layui-form" enctype="application/x-www-form-urlencoded" novalidate="novalidate">
        <div class="tab-title">
            <a class="linkABlue" href="javascript:void(0);">注册</a>
        </div>
        <div class="tip-box visiblility-hidden">
            <i class="err-ico"></i>
            <span class="tip-font"></span>
            <span class="close-ico"></span>
        </div>
        <div class='normalInput'>
            <input class="pl_5 inp-focus" type="text" value="" name="duanxin" id="account" maxlength='50' placeholder='验证短信' autocomplete='off' />
        </div>
        <div class='normalInput'>
            <input class="pl_5 inp-focus" type="text" value="" name="name" id="account" maxlength='50' placeholder='昵称' autocomplete='off' />
        </div>
        <div class='normalInput'>
            <input class="pl_5 inp-focus" type="password" value="" name="password" id="password" maxlength='50' placeholder='密码' autocomplete='off' />
        </div>
        <div class='normalInput'>
            <input class="pl_5 inp-focus" type="password" value="" name="password_confirmation" id="repassword" maxlength='50' placeholder='确认密码' autocomplete='off' />
        </div>
        <span id="j_geetest_error" class="error geetest_error" style="display:none"></span>

        <div id='flymeService' class="rememberField" style="font-size:12px;">
            <label class="pointer" for="acceptFlyme" tabindex="0">点击立即注册，即表示您同意并愿意遵守</label>
            <a href="/serviceAgreement" target='_blank' class="linkABlue">Flyme服务协议</a>
            <label class="pointer">和</label>
            <a href="http://www.meizu.com/legal.html" target='_blank' class="linkABlue">法律声明</a>
        </div>
        <a id="nextStep" class="fullBtnBlue register-btn" lay-submit lay-filter="formDemo" data-step='1'>立即注册</a>
        <a id="toLogin" class="btn-go2register" href="https://login.flyme.cn/login/login.html">登录</a>
    </form>
</div>
<div id="hideWrap" style="width:0; height:0;display:none;overflow:hidden;visibility: hidden;">
    <div id="globalName" style="display:none"></div>
    <div id="globalContainer" style="display:none"></div>
</div>
</body>
<script>
    layui.use(['form','jquery','layer'], function(){
        var $ = layui.jquery;
        var form = layui.form;
        var layer = layui.layer;
        form.on('submit(formDemo)', function(data){
            $.ajax({
                type: "POST",
                url: "/regCheck",
                dataType:"json",
                data: data.field,
                success:(function(msg){
                    if(msg.error ==1){
                        layer.msg(msg.info,function(){
                            location.href ="/reg";
                        });
                    }else{
                        layer.alert(msg.info,function () {
                            location.href ="/login";
                        })
                    }
                }),
                statusCode: {
                    422: function(data) {
                        layer.msg('账号或密码格式错误', function(){
                        });
                    }
                }
            });
            return false;
        });
    });
</script>

</html>